public class VarargsTest {

  public static void main(String[] args) {
    double m = max(3.1, 40.4, -5, 50.321);
    System.out.println(m);
  }


  private static double max(double... values) {
    double largest = Double.MIN_VALUE;
    for (double v : values) {
      largest = v > largest ? v : largest;
    }
    return largest;
  }
}
